<template>
  <div class="app-container">
    <!-- 添加或修改博文信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="审核状态" prop="checkStatus"  >
          <el-select v-model="form.checkStatus" placeholder="请选择审核状态">
            <el-option
              label="审核通过"
              value="2"
            ></el-option>
            <el-option
              label="审核不通过"
              value="3"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="审核备注" prop="checkRemark" >
          <el-input v-model="form.checkRemark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>

import { checkXx } from '@/api/business/check'


export default {
  name: "CheckOper",
  dicts: ['check_status'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      title:"审核",
      open:false,
      // 表单参数
      form: {
        id: "",
        checkStatus: "2",
        checkRemark: null,
      },
      // 表单校验
      rules: {
        id: [
          { required: true, message: "业务Id不能为空", trigger: "blur" }
        ],
        checkStatus: [
          { required: true, message: "请选择审核状态", trigger: "blur" }
        ],

      }
    };
  },
  created() {


  },
  methods: {
    // 取消按钮
    cancel() {
      this.open = false;
    },
    initCs(url,id,title){
      this.open=true;
      this.form.checkRemark="";
      this.form.checkStatus="2";
      this.form.id=id;
      this.form.userId=id;
      if(title){
        this.title=title;
      }
      this.url=url;
    },

    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            checkXx(this.form,this.url).then(response => {
              this.$modal.msgSuccess("操作成功");
              this.form.checkRemark="";
               this.open = false;
              this.$parent.getList();
              // this.getList();
            });
          }
        }
      });
    },

  }
};
</script>
